/**
 * internal.h
 * interface untuk tipe data internal utama
 * Fri, 4 Dec 2009
 * By Kristanto 13208071
 * */

#ifndef internal_h
#define internal_h

#include "../boolean.h"
#include "../date/date.h"

#define MaxStudents 61
#define MaxLectures 61
#define MaxTake 21
#define MaxConditionArgs 21
#define null -1

typedef struct {
	string NIM , Nama , KotaAsal;
	Date TglLahir;
	float IPK;
	int JumlahSKS;
	string Node;
} TStudent;
/**
 * Tipe data untuk mendefinisikan 1 buah record mahasiswa
 * */

typedef struct {
	TStudent t[MaxStudents];
	int NStudents;
} TTabstudents;
/**
 * Tipe data untuk tabel mahasiswa
 * */

typedef struct {
	string Kode , Nama , Bidang;
	int SKS;
	string Node;
} TLecture;
/**
 * Tipe data untuk mendefinisikan 1 buah record matakuliah
 * */

typedef struct {
	TLecture t[MaxLectures];
	int NLectures;
} TTablectures;
/**
 * Tipe data untuk tabel matakuliah
 * */

typedef struct {
	int Start , End;
} TAcademicYear;
/**
 * Tipe tahun akademik
 * */

typedef struct {
	string NIM , Kode;
	int Semester;
	TAcademicYear ThnAkademik;
	char Nilai;
	string Node;
} TLectures_Students;
/**
 * Tipe data 1 record pengambilan mata kuliah
 * */

typedef struct {
	TLectures_Students t[MaxStudents * MaxTake];
	int NRelation;
} TTablectures_students;
/**
 * Tipe data pivot table pengambilanmk
 * */

#define forup(i,a,b) for(i=a ; i<=b ; i++)
#define fordown(i,b,a) for(i=b ; i>=a ; i--)
#define MaxNode 21

typedef struct {
	string Name;
	boolean isServer , isClient;
	boolean IsStudentsExists , IsLecturesExists , IsLectures_StudentsExists;
	float CPUTime;
	TTabstudents students;
	TTablectures lectures;
	TTablectures_students lectures_students;
} TNode;
/**
 * Tipe data penampung atribut dari 1 site
 * */

typedef struct {
	TNode node[MaxNode];
	int NNode;
} TNodeList;
/**
 * Tipe data array of sites/nodes
 * */

typedef struct {
	int org , dest;
	float bandwidth;
} TEdge;
/**
 * Tipe data penampung 1 buah sisi
 * */

typedef struct {
	TEdge edge[MaxNode * MaxNode];
	int NEdge;
} TAdjList;
/**
 * Tipe data adjacency list
 * */

typedef struct {
	int path[MaxNode];
	int PathLength;
	float Cost;
} TRetvalDijkstra;
/**
 * tipe data nilai balik dari fungsi pencarian jalur
 * */

typedef float TAdjMatrix[MaxNode][MaxNode];
/**
 * Tipe data untuk adjacency matrix
 * */

#endif
